package com.just.springbootbatch.batch;

import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;

/**
 * 自定义监听器实现JobExecutionListener接口
 */
public class CsvJobListener implements JobExecutionListener {
    private long startTime;
    private long endTime;
    @Override
    public void beforeJob(JobExecution jobExecution) {
         startTime=System.currentTimeMillis();
         System.out.println("任务处理开始");
    }

    @Override
    public void afterJob(JobExecution jobExecution) {
         endTime=System.currentTimeMillis();
         System.out.println("任务处理结束");
         System.out.println("任务处理时长："+(endTime-startTime)+"ms");
    }
}
